#include <bits/stdc++.h>
using namespace std;
using LL = long long;
LL a[1000005];

int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);
  int p = 1, q = 1;
  int ans = n;
  while (p <= n && q <= n) {
    cout << p << " " << q << endl;
    if (a[p] == 0) {
      p++;
      continue;
    }
    LL x = a[p];
    while (q <= n && x > a[q]) {
      q++;
    }
    if (q <= n) {
      ans--;
      a[p] = 0, a[q] = 0;
      q++;
      p++;
    }
  }

  cout << ans << endl;

  return 0;
}